<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    div {
      width: 100px;
      height: 100px;
      border: 5px solid green;

    }
  </style>
</head>

<body>
  <div id="d1">1</div>
  <div id="d2">2</div>
  <div id="d3">3</div>
</body>
<script>
  function sx() {
    var srlf = this
    setTimeout(function () {

      srlf.style.background = 'red'
    }, 2000)
  }


  const d1 = document.getElementById('d1')
  const d2 = document.getElementById('d2')
  const d3 = document.getElementById('d3')
  d1.onclick = sx
  d2.onclick = sx
  d3.onclick = sx
</script>

</html>